Git Kata 5: Run a Git Server

So far, we’ve been working with a local repository. Local repositories are used by an individual developer to work with a local copy of a codebase. The previous katas have demonstrated how to commit changes to a local repository.

This kata will start work with a remote repository. The first step is to set up a local Git server. We’ll be using Gogs, an open-source, lightweight Git server.

Step 1: Create an admin account of Gogs#

To create a new account:

  • Click the “Need an account?” link and create an account with the following details:
Creating an admin account

Gogs starts for the first time after setup with no accounts. The first account that’s set up in Gogs will automatically be made an administrator. This step registers a new user with Gogs. We can use the same username/password combination as the LVM account or choose another. This account is created in Gogs and is different from the account used to log in to the LVM.

Then, we log in to Gogs with the account credentials we just created.

Logging in to Gogs

Step 2: Create a repository#

Select “New Repository” from the plus (+) drop-down.

Selecting the new repository from plus dropdown

Enter “web-storelist” in the “Repository Name” section and then click the “Create Repository” button.

Creating a new repository

This step creates a new repository called “web-storelist.” We’ll use this repository in the next kata to learn about how multiple developers collaborate by contributing to the remote repository.

Step 3: Add users#

The following is the sequence of steps to add users:

  • Open the “Admin Panel.”
  • Select “Users.”
  • Click “Create New Account.”
Clicking the “Create New Account” button
  • Keep the following:
Creating a user account
  • Select “Users” from the left navigation and create a second account.
  • Keep the following:
  • Click “Create New Account.”
Creating a second user account

Step 4: Set the repository permissions#

The following is the sequence of steps to set repository permissions:

  • Click “Dashboard” in the top navigation bar.
  • Select “web-storelist” under “My Repositories.”
Selecting web-storelist
  • Click “Settings” on the right.
  • Click “Collaboration” on the left.
Clicking the “Collaboration” button in settings
  • Enter “ken” in the field; select the “ken.coder” account.
  • Click “Add New Collaborator.”
Adding ken as a new collaborator

Repeat the previous steps for the “carrie.coder” account.

Adding carrie as a new collaborator

This step creates two new users, Ken and Carrie Coder. Ken and Carrie are granted write access by default. This will allow them to contribute to this repository.

Ken and Carrie will be formally introduced Git Kata 7.

Git Kata 4: Merge Conflicts

Git Kata 6: Remote Repositories